const ScreencastIface = loadInterfaceXML('org.gnome.Shell.Screencast');
const ScreencastProxy = Gio.DBusProxy.makeProxyWrapper(ScreencastIface);
+let screenshotNotificationSource = null;
+function getScreenshotNotificationSource() {
+ if (!screenshotNotificationSource) {
+ screenshotNotificationSource = new MessageTray.Source({
+ // Translators: notification source name for screenshots and recordings.
+ title: _('Screen Capture'),
+ iconName: 'screenshooter-symbolic',
+ });
+
+ screenshotNotificationSource.connect('destroy', () => {
+ screenshotNotificationSource = null;
+ });
+ Main.messageTray.add(screenshotNotificationSource);
+ }
+
+ return screenshotNotificationSource;
+}
+
const IconLabelButton = GObject.registerClass(
class IconLabelButton extends St.Button {
_init(iconName, label, params) {
}
_showNotification(title) {
- const source = new MessageTray.Source({
- // Translators: notification source name.
- title: _('Screenshot'),
- iconName: 'screencast-recorded-symbolic',
- });
+ const source = getScreenshotNotificationSource();
const notification = new MessageTray.Notification({
source,
title,
Main.panel.closeCalendar();
}
- Main.messageTray.add(source);
source.addNotification(notification);
}
);
// Show a notification.
- const source = new MessageTray.Source({
- // Translators: notification source name.
- title: _('Screenshot'),
- iconName: 'screenshot-recorded-symbolic',
- });
+ const source = getScreenshotNotificationSource();
const notification = new MessageTray.Notification({
source,
// Translators: notification title.
});
}
- Main.messageTray.add(source);
source.addNotification(notification);
return file;